/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bs.Beans;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Bone
 */
@Entity
@Table(name = "orcamento_empresarial")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OrcamentoEmpresarial.findAll", query = "SELECT o FROM OrcamentoEmpresarial o")})
public class OrcamentoEmpresarial implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer id;
    @Column(length = 30)
    private String nome;
    @Lob
    @Column(length = 65535)
    private String descricao;
    @Column(name = "DATA_INICIAL")
    @Temporal(TemporalType.DATE)
    private Date dataInicial;
    @Column(name = "NUMERO_PERIODOS")
    private Integer numeroPeriodos;
    @Column(name = "DATA_BASE")
    @Temporal(TemporalType.DATE)
    private Date dataBase;
    @JoinColumn(name = "ID_ORCAMENTO_PERIODO", referencedColumnName = "ID", nullable = false)
    @ManyToOne(optional = false)
    private OrcamentoPeriodo idOrcamentoPeriodo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idOrcamentoEmpresarial")
    private List<OrcamentoDetalhe> orcamentoDetalheList;

    public OrcamentoEmpresarial() {
    }

    public OrcamentoEmpresarial(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public Date getDataInicial() {
        return dataInicial;
    }

    public void setDataInicial(Date dataInicial) {
        this.dataInicial = dataInicial;
    }

    public Integer getNumeroPeriodos() {
        return numeroPeriodos;
    }

    public void setNumeroPeriodos(Integer numeroPeriodos) {
        this.numeroPeriodos = numeroPeriodos;
    }

    public Date getDataBase() {
        return dataBase;
    }

    public void setDataBase(Date dataBase) {
        this.dataBase = dataBase;
    }

    public OrcamentoPeriodo getIdOrcamentoPeriodo() {
        return idOrcamentoPeriodo;
    }

    public void setIdOrcamentoPeriodo(OrcamentoPeriodo idOrcamentoPeriodo) {
        this.idOrcamentoPeriodo = idOrcamentoPeriodo;
    }

    @XmlTransient
    public List<OrcamentoDetalhe> getOrcamentoDetalheList() {
        return orcamentoDetalheList;
    }

    public void setOrcamentoDetalheList(List<OrcamentoDetalhe> orcamentoDetalheList) {
        this.orcamentoDetalheList = orcamentoDetalheList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrcamentoEmpresarial)) {
            return false;
        }
        OrcamentoEmpresarial other = (OrcamentoEmpresarial) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bs.Beans.OrcamentoEmpresarial[ id=" + id + " ]";
    }
    
}
